import {defineStore} from 'pinia';
import {reactive, computed} from 'vue';
import {routes} from '@/router/routes.ts';
import type {RouteRecordRaw} from 'vue-router';

export const useRouterStore = defineStore('routerStore', () => {

  const menuRouters = computed(() => {
    if (!routes[0].children) {
      return null;
    }
    return routes[0].children.filter(route => !route.meta?.hidden)
  })

  const allRouters = reactive<RouteRecordRaw[]>(routes);

  return {menuRouters, allRouters};
});
